package com.ktjiaoyu.crm.dao;


import com.ktjiaoyu.crm.pojo.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

/**
 * 用户数据访问层接口
 */
public interface UserDao extends JpaRepository<User,Long>, JpaSpecificationExecutor<User> {

    //JPA自定义查询：xxx实体类名称xx属性名
    User findUserByUsrName(String name);

    @Query("from User  where usrRoleId=?1 ")
    List<User> findByRoleId(Long roleId);

    //分页查询
    Page<User> findByUsrRoleId(Long roleId, Pageable pageable);

}